﻿using DBUtility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Threading.Tasks;

namespace MJCOMMEN_CS.Commen_cs
{
    public class Shopping
    {
        public string AddProduct(string imgurl)
        {
            return "";
            //string virtualFilePath = "~//" + CAppConfiguration.Current.BbsUploadFilePath;
            //string savePath = Server.MapPath(virtualFilePath); //保存文件物理路径 

            ////调用CFileUpload类 
            //CFileUpload upload = new CFileUpload(FileUploadImg, savePath, false);

            ////上传图片文件 
            //bool ret = upload.UploadImage();
            //if (ret)
            //{
            //    string filename = System.IO.Path.GetFileName(upload.LastUploadedFile);
            //    this.hfLastUploadImage.Value = filename;
            //    string root = CGlobals.GetHttpRoot(this);
            //}
        }

        public string Getparentid(string parentid)
        {
            string parendids = "";
            DataTable dt = Getparent(parentid);
            if (dt.Rows.Count > 0)
            {
                parendids = dt.Rows[0]["product_id"].ToString();

            }
            else { parendids = ""; }
            return parendids;
        
        }


        /// <summary>
        /// 根据parentid获取表数据
        /// </summary>
        /// <param name="parentid"></param>
        /// <returns></returns>
        public static DataTable Getparent(string parentid)
        {
           
            Sqlopenhander doh = new Sqlopenhander();
            doh.Reset();
            doh.Sqlcmd = " select * from Product where parent_id=@id and deletes='1'";
            doh.add_alConditionParameters("@id", parentid);
            DataTable DT = doh.GetDataTable();
            return DT;
        }
    }
}
